/**
 * Created by linxiaofen on 2017/5/12.
 */
'use strict';
app.component('personalPortfolio',{
        templateUrl:'./view/template/portfolio.html',
        controller:function( httpService, $timeout){
            mixituoInit();
            angular.element(document).ready(function () {
                scrollBarsCtrl();
            });
            $('#portfolioList').on('$destroy', function () {
                $('#portfolioList').mixItUp('destroy');
            });

            function mixituoInit(){
                var containerEl = document.querySelector('#portfolioList');
                var mixer = mixitup(containerEl);

                $('#portfolioList .mix').hover(

                    function () {

                        $(this).find('.label').stop().animate({bottom: 0}, 200, 'easeOutQuad');

                        $(this).find('img').stop().animate({top: -30}, 500, 'easeOutQuad');

                    },

                    function () {

                        $(this).find('.label').stop().animate({bottom: -40}, 200, 'easeInQuad');

                        $(this).find('img').stop().animate({top: 0}, 300, 'easeOutQuad');

                    }

                );
            }

            function scrollBarsCtrl(){
                if(window.matchMedia("(max-width: 800px)").matches){
                    $("#portfolio").mCustomScrollbar("destroy");
                }else{
                    $("#portfolio").mCustomScrollbar({
                        theme: "dark-2",
                        contentTouchScroll: true,
                        advanced: {
                            updateOnContentResize: true,
                            updateOnBrowserResize: true,
                            autoScrollOnFocus: false
                        }
                    });
                }
            }
        }
});
